<!DOCTYPE html>
<html style="height: 100%;">
<head>
    <title>需求首页</title>
    <% include ../../layouts/import.ejs %>
</head>
<body style="height: 100%;">
<% include ../../layouts/header.ejs %>
<% include ../../layouts/processHeader.ejs %>
<div class="height" style="background: #F8F6F2">
    <div class="container main-content">

        <div class="row">
            <form id="mainForm" role="form" method="post" action="/process/requirement/save">
                <input type="hidden" value="<%= project.id %>" name="id"/>
                <div class="form-group">
                    <label class="control-label">模块名称<span style="color:red;font-weight:bolder">*</span></label>
                    <input type="text" value="<%= project.moduleName %>" id="moduleName" name="moduleName"
                           class="form-control"
                           data-provide="typeahead" autocomplete="false" placeholder="输入打开下拉选择"/>
                    <input type="hidden" value="<%= project.moduleId %>" id="moduleId" name="moduleId"/>
                </div>
                <div class="form-group">
                    <label class="control-label">需求名称<span style="color:red;font-weight:bolder">*</span></label>
                    <input type="text" value="<%= project.requirementName %>" id="requirementName"
                           name="requirementName"
                           class="form-control"/>
                </div>
                <div class="form-group">
                    <label class="control-label">详情<span style="color:red;font-weight:bolder">*</span></label>
                    <textarea type="text" id="detail" name="detail"
                              class="form-control"><%= project.detail %></textarea>
                </div>
                <div class="form-group">
                    <label class="control-label">优先级<span style="color:red;font-weight:bolder">*</span></label>
                    <select type="text" value="<%= project.level %>" id="level" name="level"
                            class="form-control">
                        <option value="3">紧急</option>
                        <option value="2">高</option>
                        <option value="1" selected>普通</option>
                        <option value="0">低</option>
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label">版本<span style="color:red;font-weight:bolder">*</span></label>
                    <select type="text" value="<%= project.versionId %>" id="versionId" name="versionId"
                            class="form-control">
                        <% for(var i = 0; i < versionList.length; i++) { %>
                        <option value="<%= versionList[i].id %>" <%= versionList[i].id===project.versionId?'selected':'' %> ><%= versionList[i].version_number %></option>
                        <% } %>
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label">需求提出人<span style="color:red;font-weight:bolder">*</span></label>
                    <input type="text" value="<%= project.proposeUser %>" id="proposeUser" name="proposeUser"
                           class="form-control"/>
                </div>
                <div class="form-group">
                    <label class="control-label" for="use_role">使用角色<span style="color:red;font-weight:bolder">*</span></label>
                    <textarea type="text" id="useRole" name="useRole"
                              class="form-control"><%= project.useRole %></textarea>
                </div>
                <button type="submit" class="person-preservation btn btn-primary">保存</button>
                <button type="button" data-dismiss="modal" class="btn btn-default">关闭</button>
            </form>
        </div>
    </div>

    <% include ../../layouts/footer.ejs %>
</div>
</body>

<script>


    $(function () {
        $('#project-management').addClass('select-active');
        $("#requirement").addClass("click-change")

        $('#moduleName').typeahead({
            source: function (query, process) {
                return $.get('/process/module/moduleList?keyword=' + query, function (result) {
                    return process(result);
                });
            },
            autoSelect: true,
            afterSelect: function (item) {
                $('#moduleId').val(item.id);
            }
        });


    })
</script>
</html>